package view;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.WindowConstants;
import javax.swing.JFrame;
import javax.swing.JLabel;

import controller.Maquina;
import controller.exception.MaquinaInstantiationException;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class JuegoFeedbackGano extends javax.swing.JPanel {
	private static JuegoFeedbackGano instancia;
	private JLabel jLabel1;
	private JLabel jLabel2;
	private JButton aceptar;

	private JuegoFeedbackGano() {
		super();
		initGUI();
	}
	
	public static JuegoFeedbackGano getInstance() {
		if (instancia == null) {
			instancia = new JuegoFeedbackGano();
		}
		return instancia;
	}
	
	private void initGUI() {
		try {
			this.setPreferredSize(new java.awt.Dimension(361, 177));
			this.setLayout(null);
			{
				jLabel1 = new JLabel();
				this.add(jLabel1);
				jLabel1.setText("Feliciationes!");
				jLabel1.setBounds(121, 25, 173, 40);
				jLabel1.setFont(new java.awt.Font("Dialog",0,20));
			}
			{
				jLabel2 = new JLabel();
				this.add(jLabel2);
				jLabel2.setText("Usted ha ganado!");
				jLabel2.setBounds(129, 71, 151, 15);
			}
			{
				aceptar = new JButton();
				this.add(aceptar);
				aceptar.setText("Aceptar premio");
				aceptar.setBounds(129, 103, 109, 37);
				aceptar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent e) {
						try {
							Maquina.getInstancia().aceptarPremio();
							Juego.getInstance().cerrarVentanaDeFeedback();
						} catch (MaquinaInstantiationException e1) {
							e1.printStackTrace();
						}
					}
				});
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
